a ={'name':'张三','age':18} # 字典
print(a['name'])
print(a)

b = dict(name = '张三',age = 18)
print(b)

c =dict([('name','张三'),('age',18)])
print(c)

k =['name','age']
v = ['张三',18]
d = zip (k,v)
e = dict(d)
print(e)

f = dict.fromkeys(['name','age']) #只能创建以为为空的字典
print(f)

for e in f:
    print( e)
    print(f[e])

print(f.get('name','不存在(这是一个默认值)'))


dict1 = {'name':'张三','age':18}
dict2 = {'name':'小张','heigh':180}
# dict1.update(name = '小张')
dict1.update(dict2)
print(dict1)

print('-------')
q,w=dict2
print(q,w) #如果有超出就不会生效



